import Router from 'koa-router';
import { CustomerController } from '@/controllers/customer.controller';
import authMiddleware from '@/middlewares/auth.middleware';

const router = new Router({prefix: '/api/customers'});

const customerController = new CustomerController();

/**
 * @route POST /customers/create
 * @description 创建新客户
 * @access 需要认证
 */
router.post('/create', authMiddleware, customerController.createCustomer);

/**
 * @route POST /customers/list
 * @description 获取客户列表（分页）
 * @access 需要认证
 */
router.post('/list', authMiddleware, customerController.getCustomerList);

/**
 * @route POST /customers/delete
 * @description 删除客户
 * @access 需要认证
 */
router.post('/delete', authMiddleware, customerController.deleteCustomer);

/**
 * @route POST /customers/update
 * @description 更新客户信息
 * @access 需要认证
 */
router.post('/update', authMiddleware, customerController.updateCustomer);

/**
 * @route GET /customers/detail
 * @description 获取客户详情
 * @access 需要认证
 */
router.get('/detail/:id', authMiddleware, customerController.getCustomerDetail);

/**
 * @route POST /customers/stored-value-card/create
 * @description 为客户创建储值卡
 * @access 需要认证
 */
router.post('/stored-value-card/create', authMiddleware, customerController.createStoredValueCard);

/**
 * @route GET /customers/:customerId/stored-value-cards
 * @description 获取指定客户的会员卡列表
 * @access 需要认证
 */
router.get('/:customerId/stored-value-cards', authMiddleware, customerController.getCustomerStoredValueCards);

export default router; 